package cn.stylefeng.guns.modular.business.frequency.financecheck.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.financecheck.service.FinanceCheckService;
import cn.stylefeng.guns.modular.business.frequency.financecheck.model.param.FinanceCheckParam;

import javax.annotation.Resource;

/**
 * 对账单结算记录表 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:17
 */
@RestController
public class FinanceCheckController {

    @Resource
    private FinanceCheckService financeCheckService;

    /**
     * 分页查询对账单结算记录表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @GetMapping("/financeCheck/page")
    @BusinessLog(title = "对账单结算记录表_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(FinanceCheckParam financeCheckParam) {
        return new SuccessResponseData(financeCheckService.page(financeCheckParam));
    }

    /**
     * 获取全部对账单结算记录表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @GetMapping("/financeCheck/list")
    @BusinessLog(title = "对账单结算记录表_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(FinanceCheckParam financeCheckParam) {
        return new SuccessResponseData(financeCheckService.list(financeCheckParam));
    }

    /**
     * 查看详情对账单结算记录表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @GetMapping("/financeCheck/detail")
    @BusinessLog(title = "对账单结算记录表_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(FinanceCheckParam.detail.class) FinanceCheckParam financeCheckParam) {
        return new SuccessResponseData(financeCheckService.detail(financeCheckParam));
    }

    /**
     * 添加对账单结算记录表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @PostMapping("/financeCheck/add")
    @BusinessLog(title = "对账单结算记录表_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(FinanceCheckParam.add.class) FinanceCheckParam financeCheckParam) {
        financeCheckService.add(financeCheckParam);
        return new SuccessResponseData();
    }

    /**
     * 删除对账单结算记录表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @PostMapping("/financeCheck/delete")
    @BusinessLog(title = "对账单结算记录表_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(FinanceCheckParam.delete.class) FinanceCheckParam financeCheckParam) {
        financeCheckService.delete(financeCheckParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑对账单结算记录表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @PostMapping("/financeCheck/edit")
    @BusinessLog(title = "对账单结算记录表_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(FinanceCheckParam.edit.class) FinanceCheckParam financeCheckParam) {
        financeCheckService.edit(financeCheckParam);
        return new SuccessResponseData();
    }

    /**
     * 修改状态
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @PostMapping("/financeCheck/changeStatus")
    @BusinessLog(title = "对账单结算记录表_修改状态", opType = LogAnnotionOpTypeEnum.CHANGE_STATUS)
    public ResponseData changeStatus(@RequestBody @Validated(FinanceCheckParam.changeStatus.class) FinanceCheckParam financeCheckParam) {
        financeCheckService.changeStatus(financeCheckParam);
        return new SuccessResponseData();
    }

}
